angular.module('App').controller('PrintInitManageController', ['$scope', '$sce','$http', 'BaseFunction', 'ParameterService', '$cookies',
    function($scope, $sce, $http, BaseFunction, ParameterService,$cookies) {
        $scope.serverUrl = '';
        // var Authorization = 'Bearer ' + $cookies.get('U9USS');
        var Authorization = 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJfaWQiOiI1Njc2YzQ4MGFiYmYxMmNjMDgzMTVmYTkiLCJDb2RlIjoiYWRtaW4iLCJSb2xlcyI6WyI1NjgwYzU5Y2U2Njk5NGFjMjg5MDFhM2UiLCI1NjgwZDViNmU2Njk5NGFjMjg5MDFhM2YiLCI1NjgwZDZlYmU2Njk5NGFjMjg5MDFhNDAiLCI1NjgwZDcxOWU2Njk5NGFjMjg5MDFhNDEiLCI1NjgwZDc0ZWU2Njk5NGFjMjg5MDFhNDIiLCI1NjgwZDc3NGU2Njk5NGFjMjg5MDFhNDMiLCI1NjgwZDc5NmU2Njk5NGFjMjg5MDFhNDQiLCI1NzMyOTg1MzBkYzJkN2MzMGZkNTZkZDYiXSwiaWF0IjoxNDY0NjkwOTg3fQ.acmljN6_W3vH-eNMUv-pzPCBGM9Btkn3waYudgrQmqc'
        //获取打印服务器地址
        // ParameterService.getParameterValue(null,'DCServer', function(dataUrl){
        //     var reqData = {
        //         Code: "PrintServer",
        //         Classification: "SystemManage"
        //     };
        //     // BaseFunction.httpRequest('http://'+ dataUrl + '/api/Common/getParameterValue', reqData, function(data){
        //     //     $scope.serverUrl = 'http://'+ data + '/PrintService/printInit.html';
        //     // });

        //     var request = new XMLHttpRequest();
        //     request.open("POST", 'http://'+ dataUrl + '/api/Common/getParameterValue');
            
        //     request.setRequestHeader("Authorization", Authorization);
        //     request.send(reqData);
            
        //     request.onreadystatechange = function() {
        //         if (request.status == '200' && request.readyState == 4) {
        //             $scope.serverUrl = 'http://'+ request.responseText + '/PrintService/printInit.html';
        //             BaseFunction.tip('成功', '成功');
        //         } else if (request.status == '400' || request.status == '404') {
        //             BaseFunction.tip('失败', '失败');
        //         }
        //     };
            
        // });   

        ParameterService.getParameterValue(null,'PublicServer', function(dataUrl){
             $scope.serverUrl = dataUrl + '/PrintService/printInit.html';
            
        });
        
        $scope.trustSrc = function(src) {
            return $sce.trustAsResourceUrl(src);
        }
  
    }
]);
